<template>
	<view>
		<mc-framework navTitle="MES工控机" @changeLevel="changeLevel">
			<!-- <template #workbench>
					<view style="height: 40px;">
					</view>
				</template> -->
			<!-- 主内容 -->
			<!-- 		<view class="TitleName">
					加料含水量测试单
				</view> -->


			<template #content>
				<view class="content" style="height: 100%;">
					<view class="contentBox">
						<view class="container">
							<uni-forms ref="baseForm" :modelValue="baseFormData">
								<view class="form-item-row">

									<uni-forms-item label="班次:" label-width="25%">
										<input v-model="baseFormData.class" type="text" placeholder="请输入班次" />
									</uni-forms-item>
									<uni-forms-item label="开始加料日期:" label-width="43%">
										<input v-model="baseFormData.StartTime" type="text" placeholder="请输入加料日期" />
									</uni-forms-item>
									<uni-forms-item label="* 料筒:" label-width="37%">
										<input v-model="baseFormData.empolorName" type="text" placeholder="请输入料筒" />
									</uni-forms-item>
									<uni-forms-item label="最低标准温度:" label-width="43%">
										<input v-model="baseFormData.EquipmentName" type="text"
											placeholder="请输入最低标准温度" />
									</uni-forms-item>
									<uni-forms-item label="最高标准温度:" label-width="43%">
										<input v-model="baseFormData.ProjectName" type="text" placeholder="请输入最高标准温度" />
									</uni-forms-item>
									<uni-forms-item label="* 点检温度:" label-width="35%">
										<input v-model="baseFormData.ProductName" type="text" placeholder="请输入点检温度" />
									</uni-forms-item>
									<uni-forms-item label="点检结果:" label-width="35%">
										<input v-model="baseFormData.ApproveName" type="text" placeholder="请输入点检结果" />
									</uni-forms-item>
									<uni-forms-item label="总重量:" label-width="25%">
										<input v-model="baseFormData.TestAgainVal" type="text" placeholder="请输入总重量" />
									</uni-forms-item>
									<uni-forms-item label="* 颜色:" label-width="35%">
										<input v-model="baseFormData.ResultVal" type="text" placeholder="请输入颜色" />
									</uni-forms-item>
									<uni-forms-item label="加料人:" label-width="25%">
										<input v-model="baseFormData.TestAgainVal" type="text" placeholder="请输入加料人" />
									</uni-forms-item>
									<uni-forms-item label="审核人:" label-width="25%">
										<input v-model="baseFormData.TestAgainVal" type="text" placeholder="请输入审核人" />
									</uni-forms-item>
									<uni-forms-item label="备注:" label-width="25%">
										<input v-model="baseFormData.TestAgainVal" type="text" placeholder="请输入备注" />
									</uni-forms-item>
								</view>
							</uni-forms>
						</view>
						<view class="table">
							<table>
								<tr>
									<th width="8%">操作</th>
									<th>序号</th>
									<th>原材料</th>
									<th>原料批次</th>
									<th>重量</th>
								</tr>
								<tr v-for="(item, index) in tableData">
									<td>
										<uni-icons type="trash" size="30" @click="trash(index)"></uni-icons>
									</td>
									<td>{{index + 1}}</td>
									<td>{{item.ProductName}}</td>
									<td>
										<input style="width: 100%;" type="text" v-model="item.MaterialBatch"></input>
									</td>
									<td>
										<input style="width: 100%;" type="text" v-model="item.Weight"
											@blur="handlerTestingNUM(item, index)"></input>
									</td>
								</tr>

							</table>

						</view>
					</view>
					<view class="bottomBtns">


						<button block @click="submit">
							保 &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp 存
						</button>

					</view>


				</view>
			</template>

		</mc-framework>
	</view>
</template>

<script>
	export default {
		data() {
			return {


				baseFormData: {
					empolorName: '管理员',
					class: '20240928',
					EquipmentID: '',
					EquipmentName: '#1 测试名称',
					ProjectName: '测试项目',
					ProductName: '测试点检温度',
					ApproveName: '管理员',
					StartTime: '2024-09-28',
					TestAgainVal: '否',
					ResultVal: '',
					WhiteORNight: '',
					Result: '',
					Colour: '',
					CheckTemperature: '',
					MinTemperature: '',
					MaxTemperature: '',
					TotalWeight: '',
					Remarks: '',

				},
				tableData: [{
						ProductName: 'ASDFGG-HJ-1',
						InvCode: '',
						ProductSpec: '',
						TestStandardNUM: '4%',
						TestingNUM: '1%',
						TestresultVal: '良好',
						Testresult: '',
						Remark: '备注'
					},
					{
						ProductName: 'ASDFGG-HJ-2',
						InvCode: '',
						ProductSpec: '',
						TestStandardNUM: '10%',
						TestingNUM: '3%',
						TestresultVal: '良好',
						Testresult: '',
						Remark: '备注'
					},
					{
						ProductName: 'ASDFGG-HJ-3',
						InvCode: '',
						ProductSpec: '',
						TestStandardNUM: '7%',
						TestingNUM: '6%',
						TestresultVal: '优秀',
						Testresult: '',
						Remark: '备注'
					},

					{
						ProductName: '',
						InvCode: '',
						ProductSpec: '',
						TestStandardNUM: '',
						TestingNUM: '',
						TestresultVal: '',
						Testresult: '',
						Remark: ''
					}


				]
			};
		},
		onLoad() {},
		onBackPress(options) { // 监听页面返回
			if (options.from == 'navigateBack') { // 通过点击路由返回
				return false;
			} else if (options.from == 'backbutton') { // 通过外置返回
				return true;
			}
		},
		methods: {
			addRow() {

			},
			submit() {

			},
			handlerTestingNUM() {

			},
			trash(index) {
				var that = this
				that.tableData.splice(index, 1)
			},
			changeLevel(data, row) {
				let routes = getCurrentPages(); //当前页面栈
				let backIndex = routes.length - row.length; // 计算返回页面栈数
				console.log(backIndex);
				uni.navigateBack({
					delta: backIndex
				})
			},
		}
	}
</script>

<style lang="scss">
	@import "../css/index.css";

	.TitleName {
		margin-top: 2rpx;
		width: 100vw;
		text-align: center;
		font-size: 20rpx;
	}

	.bottomBtns {

		padding: 1%;
		position: fixed;
		bottom: 4%;
		width: 100%;

		button {
			color: #fff;
			flex: 1;
			background-color: #51d0d0;
		}
	}
</style>